﻿/*
 * This software is the confidential and proprietary
 * information of NetBay
 * Such confidential information should not be disclosed
 * NetBay copyright(c) 2010
 */

#region Using
using System;
using System.ServiceModel.DomainServices.Server;
using System.Web;
using NetBay.Core.Log;
using System.Configuration;

#endregion

namespace Rio.Applications.Web.Services
{
    /// <summary>
    /// Class to handle Business entities in a RIA services
    /// </summary>
    public partial class BusinessEntitiesDomainService : DomainService
    {
        /// <summary>
        /// Get the NTLM account in session
        /// </summary>
        /// <returns>the User</returns>
        [Invoke]
        public string GetNTLMAccount()
        {
            string l_szRet = string.Empty;
            try
            {
                if (HttpContext.Current.Session[ParameterSession.NTLMAccount.szGetDescription()] != null)
                    l_szRet = (string)HttpContext.Current.Session[ParameterSession.NTLMAccount.szGetDescription()];
            }
            catch (Exception ex)
            {
                NetBay.Core.Log.LogManager.Instance().LogError(" EXCEPTION -> " + Environment.NewLine + ex);
            }
            return l_szRet;
        }
        /// <summary>
        /// Set the NTLM account in session
        /// </summary>
        /// <param name="p_szAccount">NTLM account</param>
        [Invoke]
        public void SetNTLMAccount(string p_szAccount)
        {
            try
            {
                HttpContext.Current.Session[ParameterSession.NTLMAccount.szGetDescription()] = p_szAccount;
                               
            }
            catch (Exception ex)
            {
                NetBay.Core.Log.LogManager.Instance().LogError(" EXCEPTION -> " + Environment.NewLine + ex);
            }
        }
    }
}